/* Kanvas Paint and Drawing Tool.
 * Copyright (C) 2011 Darryl Wallace
 * wallacdj@gmail.com / darryl@wallynet.ca
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef CANVASVIEW_H
#define CANVASVIEW_H

/*!
  @file CanvasView.h
  @author Darryl Wallace
  @date 2011
  @brief This file defines the view that works on the canvas.
  */

#include <QtCore>
#include <QtGui>
#include "LibKanvas_global.h"

#define WHEEL_NOTCH_FACTOR 1.125
#define ANGLE_INCREMENT 0.08726646259971647884618453842443 //radians = 5 degrees

class LIBKANVAS_EXPORT CanvasView : public QGraphicsView
{
    Q_OBJECT

public:
    CanvasView(QWidget *parent = 0);
    ~CanvasView();

    void wheelEvent(QWheelEvent *event);
    qreal zoomFactor() const {return _currentZoomFactor;}
    void setActive(bool active) {_active=active;}

    // Returns the current scale transform.
    QTransform scaleTransform() const;

public slots:
    void setZoomFactor(qreal zoomFactor);
    void setViewAngle (qreal angle);
    void resetZoom();

signals:

    void zoomFactorChanged(qreal zoomFactor);
    void viewAngleChanged(qreal angle); // emits the current view angle in radians

private:
    qreal _currentZoomFactor;
    qreal _currentAngle;
    bool _active;



};


#endif // CANVASVIEW_H
